package com.iweb.methoddemo;

public class MethodDemo5 {
    public static void main(String[] args) {
//        带返回值的方法定义和调用
/*
//        直接调用
        getSum(10,20,30);

//        赋值调用
        int i = getSum(10,20,30);
        System.out.println(i);

//        输出调用
        System.out.println(getSum(10,20,30));*/
        int sum1 = getSum(10, 20, 20);
        int sum2 = getSum(20, 30, 15);
        int sum = sum1 + sum2;
        System.out.println(sum);
    }

    public static int getSum(int n1, int n2, int n3) {
        int result = n1 + n2 + n3;
        return result;//返回给方法的调用处
    }
}
